package com.onlyphoto.onlymall.widget;

import android.content.DialogInterface;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;

import com.onlyphoto.onlymall.R;
import com.onlyphoto.onlymall.base.BaseDialogFragment;
import com.bumptech.glide.Glide;

/**
 * Created by gaochujia on 2019-6-27.
 */

public class DefaultLoadingDialog extends BaseDialogFragment {
    private ImageView imageView;

    @Override
    protected int getLayout() {
        return R.layout.dialog_default_loading;
    }

    @Override
    protected void initView(View contentView) {
        super.initView(contentView);
        //清除Dialog底背景模糊和黑暗度
        getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND | WindowManager.LayoutParams.FLAG_DIM_BEHIND);

        imageView = contentView.findViewById(R.id.iv_loading);
        Glide.with(contentView.getContext()).asGif().load(R.mipmap.loading).into(imageView);
    }

    @Override
    public void onDismiss(DialogInterface dialog) {
        super.onDismiss(dialog);
        imageView=null;
    }
}
